package com.lc.demo;

import com.lc.annotation.Param;
import com.lc.annotation.SQL;
import com.lc.base.BaseDAO;

import java.util.List;

public interface UserDAO extends BaseDAO<User> {

    @SQL(sql = "select id,name from user", returnType = "com.lc.demo.User")
    List<User> selectUsers();

    @SQL(sql = "select id,name from user where id = ${id}", returnType = "com.lc.demo.User")
    User selectUser(@Param("id") int id);

    @SQL(sql = "INSERT INTO stock (id, name, count, sale, version) " +
            "VALUES(${id}, ${name}, ${count}, ${sale}, ${version})",
            parameterType = "com.lc.demo.Stock")
    int insertUser(@Param("stock") Stock stock);

    @SQL(sql = "update stock set NAME =${name},sale=${sale} where id =${id}",
            parameterType = "com.lc.demo.Stock")
    int updateStock(@Param("stock") Stock stock);

    @SQL(sql = "delete from stock where id = ${id}")
    int deleteStock(@Param("id") String id);
}
